package com.kw.rabbittest.transaction;

import org.springframework.amqp.core.*;
import org.springframework.beans.factory.annotation.Qualifier;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;

import java.util.HashMap;
import java.util.Map;

@Configuration
public class RabbitMQConfig {

    public  static String userQueue = "user_queue";

    public static String playerExchange = "player";

    public static String playerQueue = "player_queue";

    public static String playerRountingKey = "player_rounting_key";


    @Bean
    public Queue userQueue(){
        return new Queue(userQueue);
    }


    @Bean
    public Binding bindingTransDirect(Queue userQueue, DirectExchange playerDirectExchange){
        return BindingBuilder.bind(userQueue).to(playerDirectExchange).with(playerRountingKey);
    }


    @Bean
    public Queue playerQueue(){
        return new Queue(playerQueue);
    }

    @Bean
    public DirectExchange playerDirectExchange(){
        return new DirectExchange(playerExchange);
    }

    @Bean
    public Binding bindingPlayerDirect(Queue playerQueue, DirectExchange playerDirectExchange){
        return BindingBuilder.bind(playerQueue).to(playerDirectExchange).with(playerRountingKey);
    }


}
